package com.ewo.entity;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;

@Data
@ToString
@NoArgsConstructor
@AllArgsConstructor
public class ResponseResult {

    private int code;
    private String message;
    private Object data;

    public static ResponseResult ok(Object data){
        ResponseResult result = new ResponseResult();
        result.setCode(1);
        result.setMessage("成功");
        result.setData(data);
        return result;
    }
    public static ResponseResult fail(){
        ResponseResult result = new ResponseResult();
        result.setCode(0);
        result.setMessage("失败");
        return result;
    }
    public static ResponseResult failCode(String message){
        ResponseResult result = new ResponseResult();
        result.setCode(0);
        result.setMessage(message);
        return result;
    }

    public static ResponseResult okCode(String message){
        ResponseResult result = new ResponseResult();
        result.setCode(1);
        result.setMessage(message);
        return result;
    }


}
